<template>
	<view class="main">
		<u-navbar :is-back="true" title="免费试听" :background="background" :border-bottom="false" title-color="#fff"
			back-icon-color="#fff"></u-navbar>
		<view class="all">
			
			<view class="classes" v-for="(item,index) in classlist" :key="index" @click="go('../../classes/privilege/privilege',item.id,item)">
				<view class="one_of">
					<view class="class_l">
						<image :src="item.cover" mode=""></image>
					</view>
					<view class="class_r">
						<view class="topic">{{item.title}}</view>
						<text class="name">讲师：{{item.lecturer}}</text>
					</view>
				</view>
				<view class="one_bottom">
					<text class="bot_l">{{item.count}}节课</text>
					<text class="bot_r">立即学习</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				background: {
					backgroundImage: 'linear-gradient(90deg, #00CC8D 28.000000000000004%, #00DDA7 100%)',
				},
				classlist: []
			}
		},
		onShow() {},
		onLoad(options) {
			this.getcalss()
		},

		methods: {
			//获取课程
			getcalss() {
				global.$http.request({
					url: '/api/home/ontrial',
					data: {
						token: uni.getStorageSync('token')
					}
				}).then(res => {
					if (res.data.code == 200) {
						this.classlist = res.data.data.data
					}
				})
			},
			go(path,id,info) {
				// console.log(JSON.stringify(info));
				// console.log(JSON.parse(JSON.stringify(info)));
				uni.navigateTo({
					url: path+'?id='+id+'&info='+encodeURIComponent(JSON.stringify(info))
				})
			},
			router() {
				uni.navigateTo({
					url: '../../indexs/index/index',
					animationType: 'zoom-fade-out',
					animationDuration: 200
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		width: 750rpx;
		height: 100%;
		font-family: PingFang SC;
		background-color: #F7F7F7;

		.main {
			padding-bottom: 80rpx;



			.all {

				margin-top: 10rpx;

				.classes {
					padding: 30rpx 30rpx 0rpx 30rpx;
					background-color: #fff;
					margin-bottom: 10rpx;

					.one_of {
						display: flex;
						align-items: center;
						padding-bottom: 26rpx;
						border-bottom: 2rpx solid #F5F7F9;

						.class_l {
							padding-right: 30rpx;

							image {
								width: 230rpx;
								height: 127rpx;
								border-radius: 6rpx;
							}
						}

						.class_r {
							.topic {
								font-size: 27rpx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #353535;
								margin-bottom: 17rpx;
							}

							.name {
								background: #FFFFFF;
								border: 2rpx solid #FF5850;
								border-radius: 6rpx;
								height: 36rpx;
								padding: 4rpx 17rpx;
								font-size: 22rpx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #FF5850;
							}
						}
					}

					.one_bottom {
						display: flex;
						justify-content: space-between;
						align-items: center;
						padding: 20rpx 0;

						.bot_l {
							font-size: 26rpx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #7B7B7B;
						}

						.bot_r {
							font-size: 30rpx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #09B06B;
						}
					}
				}
			}
		}
	}
</style>
